home *** CD-ROM | disk | FTP | other *** search
- Path: news.infi.net!usenet
- From: root <root@pcjournal.infi.net>
- Newsgroups: comp.lang.c
- Subject: Re: String problem
- Date: Tue, 02 Apr 1996 19:04:41 -0500
- Organization: InfiNet
- Message-ID: <3161C099.187E8082@pcjournal.infi.net>
- References: <826_9604020401@intermedia.qc.ca>
- NNTP-Posting-Host: h-avantgarde.dc.infi.net
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.01 (X11; I; Linux 1.2.13 i486)
-
- Trinomic Technologie wrote:
- >
- > "Can anyone tell me why NameCheck = 0 when I run the program"
- >
- > Your program will give you always this result because you can't use "==" to
- > compare strings:
- >
- > if (WhereName == "John")
- > {
- > NameCheck = 1;
- > }
- >
- > You must use fonction "strcmp()" to compare 2 strings
- >
- > ry this:
- >
- > #include "string.h"
- >
- > if (strcmp(WhereName, "John") == 0)
- > ...
- >
- > Stephane Mercier
- >
- > >> De : Trinomic.Technologie@f700.n167.z1.fidonet.org ( Fidonet: Trinomic Technologie 1:167/700 )
- > Via: root@intermedia.qc.ca ( 1:242/847 )
-
- Of course if you want to you could overload the "=" operator to enable
- you to compare strings in that manner.
-